package com.zmj.mapper;

import com.zmj.entity.SignUp;
import com.zmj.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface UserMapper {
    //    @Select("select * from t_user where account = #{account}")（弃用，写到了UserMapper.xml内）
    User getUserByAccount(@Param("account")String account);
    //    @Insert("insert into t_user (name, account, password) values ( #{user.name}, #{user.account}, #{user.password} ) ")
    int register(@Param("user")User user);

    int setTokenToUser(@Param("token") String token, @Param("id") Integer id);

    @Select("select * from t_user where token = #{token}")
    User getUserByToken(String token);

int getUserCount();

List<User>getUserList();

@Select("select * from user where account = #{account}")
    User selectUserByAccount(String account);
@Select("select * from user where name = #{name}")
User selectUserByName(String name);
@Select("select * from user where phone = #{phone}")
User selectUserByPhone(String phone);

List<User>selectUser(@Param("user")User user);

User updateUser(@Param("user")User user);

int deleteUser(@Param("idList")Integer[] id);



@Select("select * from user")
    List<User> getUserEn();
}
